#include <netinet/in.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "fyu.h"
int sock_fd;
char buf[1024];
struct sockaddr_in servaddr;
void net_init(void)
{
	sock_fd = socket(PF_INET, SOCK_DGRAM, 0);

	bzero(&servaddr, sizeof(struct sockaddr_in));
	servaddr.sin_family = AF_INET;
	inet_pton(AF_INET, "192.168.20.188", &servaddr.sin_addr);
	servaddr.sin_port = htons(9000);
}
void c_send(struct net_package net_data)
{
	int n;
	n = sendto(sock_fd, &net_data, sizeof(net_data), 0, (struct sockaddr *)&servaddr, sizeof(servaddr));
	if (n == -1)
	{
		perror("sendto");
		return;
	}
}
void c_recv(struct net_package *pnet_data)
{
	int n;
	struct net_package net_data;
	memset(pnet_data, 0, sizeof(struct net_package));
	n = recvfrom(sock_fd, pnet_data, 1024, 0, NULL, NULL);
	if (n == -1)
	{
		perror("recvfrom");
		return;
	}
}
